import { createPinia } from 'pinia'
import type { App } from 'vue'
import useLoginStore from './login'
import { usePersistPlugin } from '@/hooks/usePersistPlugin'

/**
 * 创建大仓库
 */
export const pinia = createPinia()
// store.use(persistPlugin)
function registerStore(app: App) {
  app.use(pinia)
  pinia.use(usePersistPlugin)
  const loginStore = useLoginStore()
  // 初始化加载本地缓存,刷新后菜单不会丢失
  loginStore.loadLocalCacheAction()
}
export default registerStore
